package dao;

public class SqlString {
	public static final String

	//user
			selectUser = "select id,name,email,password,gender,birthday,sign,ctime,lastlogin,level,img,qq from user where email=?;",
			selectUserbyName = "select id from user where name=?;",
			selectUserbyid = "select * from user where id=",

			insertUser = "insert into user(email,password,name)values(?,?,?)",
			updateUser = "update user set name=?,sign=?,gender=?,birthday=?,qq=?,addr=? where id=?",
			updateUserImg = "update user set img=? where id=?",
			updatePwd = "update user set password=? where id=?",
			selectUidsByName = "select id from user where name=?",
	
	//follow
			insertFollow = "insert into follow(uid,itemid)values(?,?)",
	//comment
			insertComment = "insert into comment(itemid,uid,content,vote) values(?,?,?,?)",
			CommentTime = "select count(*) from comment where uid=? and itemid=? and type>0",
			updateComment = "update comment set vote=vote+1 where id=?",
			selectCommentByItemId = " select c.*,u.name from comment c,user u where c.itemid=? and c.del=0 and c.type=0 and c.uid=u.id order by c.vote desc,c.ctime desc limit ?,?",
			selectCommentByUid = "select  c.content,c.itemid,c.ctime,c.type,i.name,i.img   from comment c,item i  where c.uid=? and c.del=0 and c.itemid=i.id order by c.ctime desc limit  ?,?",
			selectCommentCount="select count(*) from comment where del=0 and type=0 and itemid=",
			selectCommentedCount="select count(*) as commentedcount from comment where uid=? and del=0",
			selectVoteInfo="select * from comment where type=",
			
	//		item
			insertItem = "insert into item(name,name_py,name_py2,tags,img) values(?,?,?,?,?)",
			updateItemhot = "update item set hot=hot+? where id=? ",
			updateItemComment_count = "update item set comment_count=comment_count+? where id=? ",
			selectItemById = "select * from item where id=?", 
			selectItemByName_py2 = "select * from item where name_py2 like ", 
	// vote
			insertVote = "insert into comment(itemid,uid,type)  values(?,?,?)",
			selectVote = "select count(*)as count from comment where uid=? and type=?",
			
//			tmp_search
			selectTmp_search="select * from tmp_search where keyid=? and ctime>date_sub(now(),interval ? hour)",
			insertTmp_search="insert into tmp_search(keyid,tags,itemids,mtime) values(?,?,?,now())on duplicate key update itemids=?,mtime=now()",
			End = "";

}
